<!--
 * @Author: HeAo
 * @Date: 2022-08-24 19:27:18
 * @LastEditTime: 2022-08-24 19:41:01
 * @LastEditors: HeAo
 * @Description: 
 * @FilePath: \JavaScripe\day-13事件机制\07-用户界面事件.html
 * 别乱动！
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<!-- onresize 在 window 或窗格上当窗口或窗格被缩放时触发。  -->

<body onresize="myFun()">
  <img src="https://t7.baidu.com/it/u=1595072465,3644073269&fm=193&f=GIF" alt="" width="300px" height="300px">
  <input type="text" name="" id="input">
  <script>
    // 1、onload 监听某些事情是否加载完毕 window img
    window.onload = function () {
      console.log('window onload');
    }
    // getElementsByTagName 元素标签名选择器
    document.getElementsByTagName('img')[0].onload = function () {
      console.log('img onload');
    }

    // 2、select 在文本框（<input>或 textarea）上当用户选择了一个或多个字符时触发。
    var input = document.getElementById('input')
    input.onselect = function (event) {
      // console.log(event);
      console.log(window.getSelection().toString());

    }

    // 3、onresize
    function myFun() {
      // 打印当前窗口的宽高
      console.log(window.outerHeight, window.outerWidth);
    }
  </script>


</body>


</html>